<template>
  <Editor
    :value="props.value"
    :plugins="plugins"
    @change="props.handleChange"
    style="width: 100%"
  />
</template>

<script setup lang="ts">
import gfm from "@bytemd/plugin-gfm";
import highlight from "@bytemd/plugin-highlight";
import { Editor } from "@bytemd/vue-next";
import { withDefaults, defineProps } from "vue";

const plugins = [gfm(), highlight()];

/**
 * 定义组件属性类型，父类传递
 */
interface Props {
  value: string;
  handleChange: (v: string) => void;
}

/**
 * 初始化
 */
const props = withDefaults(defineProps<Props>(), {
  value: () => "",
  handleChange: (v: string) => {
    console.log(v);
  },
});
</script>

<style scoped>
::v-deep(.bytemd-status-right) {
  display: none;
}

::v-deep(.bytemd-tippy-right) {
  display: none;
}
</style>
